{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from pandas import Series, DataFrame"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df = pd.read_csv('http://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-red.csv', sep=';')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>fixed acidity</th>\n",
       "      <th>volatile acidity</th>\n",
       "      <th>citric acid</th>\n",
       "      <th>residual sugar</th>\n",
       "      <th>chlorides</th>\n",
       "      <th>free sulfur dioxide</th>\n",
       "      <th>total sulfur dioxide</th>\n",
       "      <th>density</th>\n",
       "      <th>pH</th>\n",
       "      <th>sulphates</th>\n",
       "      <th>alcohol</th>\n",
       "      <th>quality</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>7.4</td>\n",
       "      <td>0.70</td>\n",
       "      <td>0.00</td>\n",
       "      <td>1.9</td>\n",
       "      <td>0.076</td>\n",
       "      <td>11.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>0.9978</td>\n",
       "      <td>3.51</td>\n",
       "      <td>0.56</td>\n",
       "      <td>9.4</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>7.8</td>\n",
       "      <td>0.88</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2.6</td>\n",
       "      <td>0.098</td>\n",
       "      <td>25.0</td>\n",
       "      <td>67.0</td>\n",
       "      <td>0.9968</td>\n",
       "      <td>3.20</td>\n",
       "      <td>0.68</td>\n",
       "      <td>9.8</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>7.8</td>\n",
       "      <td>0.76</td>\n",
       "      <td>0.04</td>\n",
       "      <td>2.3</td>\n",
       "      <td>0.092</td>\n",
       "      <td>15.0</td>\n",
       "      <td>54.0</td>\n",
       "      <td>0.9970</td>\n",
       "      <td>3.26</td>\n",
       "      <td>0.65</td>\n",
       "      <td>9.8</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>11.2</td>\n",
       "      <td>0.28</td>\n",
       "      <td>0.56</td>\n",
       "      <td>1.9</td>\n",
       "      <td>0.075</td>\n",
       "      <td>17.0</td>\n",
       "      <td>60.0</td>\n",
       "      <td>0.9980</td>\n",
       "      <td>3.16</td>\n",
       "      <td>0.58</td>\n",
       "      <td>9.8</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>7.4</td>\n",
       "      <td>0.70</td>\n",
       "      <td>0.00</td>\n",
       "      <td>1.9</td>\n",
       "      <td>0.076</td>\n",
       "      <td>11.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>0.9978</td>\n",
       "      <td>3.51</td>\n",
       "      <td>0.56</td>\n",
       "      <td>9.4</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   fixed acidity  volatile acidity  citric acid  residual sugar  chlorides  \\\n",
       "0            7.4              0.70         0.00             1.9      0.076   \n",
       "1            7.8              0.88         0.00             2.6      0.098   \n",
       "2            7.8              0.76         0.04             2.3      0.092   \n",
       "3           11.2              0.28         0.56             1.9      0.075   \n",
       "4            7.4              0.70         0.00             1.9      0.076   \n",
       "\n",
       "   free sulfur dioxide  total sulfur dioxide  density    pH  sulphates  \\\n",
       "0                 11.0                  34.0   0.9978  3.51       0.56   \n",
       "1                 25.0                  67.0   0.9968  3.20       0.68   \n",
       "2                 15.0                  54.0   0.9970  3.26       0.65   \n",
       "3                 17.0                  60.0   0.9980  3.16       0.58   \n",
       "4                 11.0                  34.0   0.9978  3.51       0.56   \n",
       "\n",
       "   alcohol  quality  \n",
       "0      9.4        5  \n",
       "1      9.8        5  \n",
       "2      9.8        5  \n",
       "3      9.8        6  \n",
       "4      9.4        5  "
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([5, 6, 7, 4, 8, 3])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['quality'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df = pd.read_csv('../homework/usa_flights.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(201664, 14)"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>flight_date</th>\n",
       "      <th>unique_carrier</th>\n",
       "      <th>flight_num</th>\n",
       "      <th>origin</th>\n",
       "      <th>dest</th>\n",
       "      <th>arr_delay</th>\n",
       "      <th>cancelled</th>\n",
       "      <th>distance</th>\n",
       "      <th>carrier_delay</th>\n",
       "      <th>weather_delay</th>\n",
       "      <th>late_aircraft_delay</th>\n",
       "      <th>nas_delay</th>\n",
       "      <th>security_delay</th>\n",
       "      <th>actual_elapsed_time</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>02/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>1</td>\n",
       "      <td>JFK</td>\n",
       "      <td>LAX</td>\n",
       "      <td>-19.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>381.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>03/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>1</td>\n",
       "      <td>JFK</td>\n",
       "      <td>LAX</td>\n",
       "      <td>-39.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>358.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>04/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>1</td>\n",
       "      <td>JFK</td>\n",
       "      <td>LAX</td>\n",
       "      <td>-12.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>385.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>05/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>1</td>\n",
       "      <td>JFK</td>\n",
       "      <td>LAX</td>\n",
       "      <td>-8.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>389.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>06/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>1</td>\n",
       "      <td>JFK</td>\n",
       "      <td>LAX</td>\n",
       "      <td>25.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>424.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       flight_date unique_carrier  flight_num origin dest  arr_delay  \\\n",
       "0  02/01/2015 0:00             AA           1    JFK  LAX      -19.0   \n",
       "1  03/01/2015 0:00             AA           1    JFK  LAX      -39.0   \n",
       "2  04/01/2015 0:00             AA           1    JFK  LAX      -12.0   \n",
       "3  05/01/2015 0:00             AA           1    JFK  LAX       -8.0   \n",
       "4  06/01/2015 0:00             AA           1    JFK  LAX       25.0   \n",
       "\n",
       "   cancelled  distance  carrier_delay  weather_delay  late_aircraft_delay  \\\n",
       "0          0      2475            NaN            NaN                  NaN   \n",
       "1          0      2475            NaN            NaN                  NaN   \n",
       "2          0      2475            NaN            NaN                  NaN   \n",
       "3          0      2475            NaN            NaN                  NaN   \n",
       "4          0      2475            0.0            0.0                  0.0   \n",
       "\n",
       "   nas_delay  security_delay  actual_elapsed_time  \n",
       "0        NaN             NaN                381.0  \n",
       "1        NaN             NaN                358.0  \n",
       "2        NaN             NaN                385.0  \n",
       "3        NaN             NaN                389.0  \n",
       "4       25.0             0.0                424.0  "
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "df['delayed'] = df['arr_delay'].apply(lambda x: x>0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>flight_date</th>\n",
       "      <th>unique_carrier</th>\n",
       "      <th>flight_num</th>\n",
       "      <th>origin</th>\n",
       "      <th>dest</th>\n",
       "      <th>arr_delay</th>\n",
       "      <th>cancelled</th>\n",
       "      <th>distance</th>\n",
       "      <th>carrier_delay</th>\n",
       "      <th>weather_delay</th>\n",
       "      <th>late_aircraft_delay</th>\n",
       "      <th>nas_delay</th>\n",
       "      <th>security_delay</th>\n",
       "      <th>actual_elapsed_time</th>\n",
       "      <th>delayed</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>02/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>1</td>\n",
       "      <td>JFK</td>\n",
       "      <td>LAX</td>\n",
       "      <td>-19.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>381.0</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>03/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>1</td>\n",
       "      <td>JFK</td>\n",
       "      <td>LAX</td>\n",
       "      <td>-39.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>358.0</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>04/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>1</td>\n",
       "      <td>JFK</td>\n",
       "      <td>LAX</td>\n",
       "      <td>-12.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>385.0</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>05/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>1</td>\n",
       "      <td>JFK</td>\n",
       "      <td>LAX</td>\n",
       "      <td>-8.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>389.0</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>06/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>1</td>\n",
       "      <td>JFK</td>\n",
       "      <td>LAX</td>\n",
       "      <td>25.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>424.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       flight_date unique_carrier  flight_num origin dest  arr_delay  \\\n",
       "0  02/01/2015 0:00             AA           1    JFK  LAX      -19.0   \n",
       "1  03/01/2015 0:00             AA           1    JFK  LAX      -39.0   \n",
       "2  04/01/2015 0:00             AA           1    JFK  LAX      -12.0   \n",
       "3  05/01/2015 0:00             AA           1    JFK  LAX       -8.0   \n",
       "4  06/01/2015 0:00             AA           1    JFK  LAX       25.0   \n",
       "\n",
       "   cancelled  distance  carrier_delay  weather_delay  late_aircraft_delay  \\\n",
       "0          0      2475            NaN            NaN                  NaN   \n",
       "1          0      2475            NaN            NaN                  NaN   \n",
       "2          0      2475            NaN            NaN                  NaN   \n",
       "3          0      2475            NaN            NaN                  NaN   \n",
       "4          0      2475            0.0            0.0                  0.0   \n",
       "\n",
       "   nas_delay  security_delay  actual_elapsed_time  delayed  \n",
       "0        NaN             NaN                381.0    False  \n",
       "1        NaN             NaN                358.0    False  \n",
       "2        NaN             NaN                385.0    False  \n",
       "3        NaN             NaN                389.0    False  \n",
       "4       25.0             0.0                424.0     True  "
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "group_by_carrier = df.groupby(['unique_carrier','delayed'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>flight_date</th>\n",
       "      <th>unique_carrier</th>\n",
       "      <th>flight_num</th>\n",
       "      <th>origin</th>\n",
       "      <th>dest</th>\n",
       "      <th>arr_delay</th>\n",
       "      <th>cancelled</th>\n",
       "      <th>distance</th>\n",
       "      <th>carrier_delay</th>\n",
       "      <th>weather_delay</th>\n",
       "      <th>late_aircraft_delay</th>\n",
       "      <th>nas_delay</th>\n",
       "      <th>security_delay</th>\n",
       "      <th>actual_elapsed_time</th>\n",
       "      <th>delayed</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>06/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>1</td>\n",
       "      <td>JFK</td>\n",
       "      <td>LAX</td>\n",
       "      <td>25.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>424.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>09/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>1</td>\n",
       "      <td>JFK</td>\n",
       "      <td>LAX</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>400.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>03/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2</td>\n",
       "      <td>LAX</td>\n",
       "      <td>JFK</td>\n",
       "      <td>24.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>22.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>337.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>04/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2</td>\n",
       "      <td>LAX</td>\n",
       "      <td>JFK</td>\n",
       "      <td>150.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>105.0</td>\n",
       "      <td>45.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>324.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>12/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2</td>\n",
       "      <td>LAX</td>\n",
       "      <td>JFK</td>\n",
       "      <td>9.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>338.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>05/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>3</td>\n",
       "      <td>JFK</td>\n",
       "      <td>LAX</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>390.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>06/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>3</td>\n",
       "      <td>JFK</td>\n",
       "      <td>LAX</td>\n",
       "      <td>52.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>440.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>09/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>3</td>\n",
       "      <td>JFK</td>\n",
       "      <td>LAX</td>\n",
       "      <td>18.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>403.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>12/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>3</td>\n",
       "      <td>JFK</td>\n",
       "      <td>LAX</td>\n",
       "      <td>10.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>399.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>03/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>4</td>\n",
       "      <td>LAX</td>\n",
       "      <td>JFK</td>\n",
       "      <td>56.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>39.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>347.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>04/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>4</td>\n",
       "      <td>LAX</td>\n",
       "      <td>JFK</td>\n",
       "      <td>68.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>65.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>326.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>06/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>4</td>\n",
       "      <td>LAX</td>\n",
       "      <td>JFK</td>\n",
       "      <td>10.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>329.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>07/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>4</td>\n",
       "      <td>LAX</td>\n",
       "      <td>JFK</td>\n",
       "      <td>63.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>55.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>317.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>11/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>4</td>\n",
       "      <td>LAX</td>\n",
       "      <td>JFK</td>\n",
       "      <td>214.0</td>\n",
       "      <td>0</td>\n",
       "      <td>2475</td>\n",
       "      <td>11.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>203.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>302.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52</th>\n",
       "      <td>02/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>5</td>\n",
       "      <td>DFW</td>\n",
       "      <td>HNL</td>\n",
       "      <td>306.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3784</td>\n",
       "      <td>21.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>256.0</td>\n",
       "      <td>29.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>544.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53</th>\n",
       "      <td>03/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>5</td>\n",
       "      <td>DFW</td>\n",
       "      <td>HNL</td>\n",
       "      <td>10.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3784</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>501.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>04/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>5</td>\n",
       "      <td>DFW</td>\n",
       "      <td>HNL</td>\n",
       "      <td>220.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3784</td>\n",
       "      <td>220.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>500.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55</th>\n",
       "      <td>05/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>5</td>\n",
       "      <td>DFW</td>\n",
       "      <td>HNL</td>\n",
       "      <td>79.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3784</td>\n",
       "      <td>79.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>505.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>56</th>\n",
       "      <td>06/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>5</td>\n",
       "      <td>DFW</td>\n",
       "      <td>HNL</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3784</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>491.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>57</th>\n",
       "      <td>07/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>5</td>\n",
       "      <td>DFW</td>\n",
       "      <td>HNL</td>\n",
       "      <td>31.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3784</td>\n",
       "      <td>31.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>507.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>58</th>\n",
       "      <td>08/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>5</td>\n",
       "      <td>DFW</td>\n",
       "      <td>HNL</td>\n",
       "      <td>170.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3784</td>\n",
       "      <td>170.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>500.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>63</th>\n",
       "      <td>13/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>5</td>\n",
       "      <td>DFW</td>\n",
       "      <td>HNL</td>\n",
       "      <td>30.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3784</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>527.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>67</th>\n",
       "      <td>04/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>6</td>\n",
       "      <td>OGG</td>\n",
       "      <td>DFW</td>\n",
       "      <td>39.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3711</td>\n",
       "      <td>37.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>427.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>68</th>\n",
       "      <td>05/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>6</td>\n",
       "      <td>OGG</td>\n",
       "      <td>DFW</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3711</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>424.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>69</th>\n",
       "      <td>06/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>6</td>\n",
       "      <td>OGG</td>\n",
       "      <td>DFW</td>\n",
       "      <td>73.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3711</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>60.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>433.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>74</th>\n",
       "      <td>11/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>6</td>\n",
       "      <td>OGG</td>\n",
       "      <td>DFW</td>\n",
       "      <td>68.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3711</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>68.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>420.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>78</th>\n",
       "      <td>02/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>7</td>\n",
       "      <td>DFW</td>\n",
       "      <td>OGG</td>\n",
       "      <td>172.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3711</td>\n",
       "      <td>153.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>519.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>80</th>\n",
       "      <td>04/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>7</td>\n",
       "      <td>DFW</td>\n",
       "      <td>OGG</td>\n",
       "      <td>261.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3711</td>\n",
       "      <td>261.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>492.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>81</th>\n",
       "      <td>05/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>7</td>\n",
       "      <td>DFW</td>\n",
       "      <td>OGG</td>\n",
       "      <td>301.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3711</td>\n",
       "      <td>254.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>47.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>481.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>82</th>\n",
       "      <td>06/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>7</td>\n",
       "      <td>DFW</td>\n",
       "      <td>OGG</td>\n",
       "      <td>62.0</td>\n",
       "      <td>0</td>\n",
       "      <td>3711</td>\n",
       "      <td>62.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>486.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59282</th>\n",
       "      <td>04/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2393</td>\n",
       "      <td>MCO</td>\n",
       "      <td>JFK</td>\n",
       "      <td>20.0</td>\n",
       "      <td>0</td>\n",
       "      <td>944</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>173.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59283</th>\n",
       "      <td>05/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2393</td>\n",
       "      <td>MCO</td>\n",
       "      <td>JFK</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0</td>\n",
       "      <td>944</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>144.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59284</th>\n",
       "      <td>06/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2393</td>\n",
       "      <td>MCO</td>\n",
       "      <td>JFK</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0</td>\n",
       "      <td>944</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>154.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59285</th>\n",
       "      <td>07/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2393</td>\n",
       "      <td>MCO</td>\n",
       "      <td>JFK</td>\n",
       "      <td>15.0</td>\n",
       "      <td>0</td>\n",
       "      <td>944</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>133.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59286</th>\n",
       "      <td>08/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2393</td>\n",
       "      <td>MCO</td>\n",
       "      <td>JFK</td>\n",
       "      <td>18.0</td>\n",
       "      <td>0</td>\n",
       "      <td>944</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>156.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59287</th>\n",
       "      <td>09/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2393</td>\n",
       "      <td>MCO</td>\n",
       "      <td>JFK</td>\n",
       "      <td>47.0</td>\n",
       "      <td>0</td>\n",
       "      <td>944</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>46.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>130.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59288</th>\n",
       "      <td>10/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2393</td>\n",
       "      <td>MCO</td>\n",
       "      <td>JFK</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0</td>\n",
       "      <td>944</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>149.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59290</th>\n",
       "      <td>12/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2393</td>\n",
       "      <td>MCO</td>\n",
       "      <td>JFK</td>\n",
       "      <td>13.0</td>\n",
       "      <td>0</td>\n",
       "      <td>944</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>159.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59292</th>\n",
       "      <td>14/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2393</td>\n",
       "      <td>MCO</td>\n",
       "      <td>JFK</td>\n",
       "      <td>12.0</td>\n",
       "      <td>0</td>\n",
       "      <td>944</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>161.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59293</th>\n",
       "      <td>02/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2394</td>\n",
       "      <td>DFW</td>\n",
       "      <td>SNA</td>\n",
       "      <td>30.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1205</td>\n",
       "      <td>14.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>185.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59297</th>\n",
       "      <td>07/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2394</td>\n",
       "      <td>DFW</td>\n",
       "      <td>SNA</td>\n",
       "      <td>77.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1205</td>\n",
       "      <td>77.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>171.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59299</th>\n",
       "      <td>09/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2394</td>\n",
       "      <td>DFW</td>\n",
       "      <td>SNA</td>\n",
       "      <td>22.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1205</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>172.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59300</th>\n",
       "      <td>11/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2394</td>\n",
       "      <td>DFW</td>\n",
       "      <td>SNA</td>\n",
       "      <td>21.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1205</td>\n",
       "      <td>21.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>198.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59304</th>\n",
       "      <td>02/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2394</td>\n",
       "      <td>SNA</td>\n",
       "      <td>DFW</td>\n",
       "      <td>44.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1205</td>\n",
       "      <td>10.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>30.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>169.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59307</th>\n",
       "      <td>06/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2394</td>\n",
       "      <td>SNA</td>\n",
       "      <td>DFW</td>\n",
       "      <td>9.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1205</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>187.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59308</th>\n",
       "      <td>07/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2394</td>\n",
       "      <td>SNA</td>\n",
       "      <td>DFW</td>\n",
       "      <td>76.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1205</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>69.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>171.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59310</th>\n",
       "      <td>09/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2394</td>\n",
       "      <td>SNA</td>\n",
       "      <td>DFW</td>\n",
       "      <td>18.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1205</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>168.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59311</th>\n",
       "      <td>11/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2394</td>\n",
       "      <td>SNA</td>\n",
       "      <td>DFW</td>\n",
       "      <td>9.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1205</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>155.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59315</th>\n",
       "      <td>02/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2395</td>\n",
       "      <td>BHM</td>\n",
       "      <td>DFW</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0</td>\n",
       "      <td>597</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>151.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59317</th>\n",
       "      <td>04/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2395</td>\n",
       "      <td>BHM</td>\n",
       "      <td>DFW</td>\n",
       "      <td>15.0</td>\n",
       "      <td>0</td>\n",
       "      <td>597</td>\n",
       "      <td>15.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>127.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59319</th>\n",
       "      <td>06/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2395</td>\n",
       "      <td>LGA</td>\n",
       "      <td>MIA</td>\n",
       "      <td>36.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1096</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>30.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>238.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59320</th>\n",
       "      <td>07/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2395</td>\n",
       "      <td>LGA</td>\n",
       "      <td>MIA</td>\n",
       "      <td>23.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1096</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>214.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59321</th>\n",
       "      <td>08/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2395</td>\n",
       "      <td>LGA</td>\n",
       "      <td>MIA</td>\n",
       "      <td>117.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1096</td>\n",
       "      <td>117.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>196.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59322</th>\n",
       "      <td>09/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2395</td>\n",
       "      <td>LGA</td>\n",
       "      <td>MIA</td>\n",
       "      <td>16.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1096</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>199.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59327</th>\n",
       "      <td>14/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2395</td>\n",
       "      <td>LGA</td>\n",
       "      <td>MIA</td>\n",
       "      <td>7.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1096</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>218.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59329</th>\n",
       "      <td>07/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2395</td>\n",
       "      <td>MIA</td>\n",
       "      <td>LGA</td>\n",
       "      <td>57.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1096</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>57.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>168.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59330</th>\n",
       "      <td>08/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2395</td>\n",
       "      <td>MIA</td>\n",
       "      <td>LGA</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1096</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>182.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59331</th>\n",
       "      <td>09/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2395</td>\n",
       "      <td>MIA</td>\n",
       "      <td>LGA</td>\n",
       "      <td>55.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1096</td>\n",
       "      <td>12.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>43.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>157.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59332</th>\n",
       "      <td>10/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2395</td>\n",
       "      <td>MIA</td>\n",
       "      <td>LGA</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1096</td>\n",
       "      <td>12.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>170.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59334</th>\n",
       "      <td>12/01/2015 0:00</td>\n",
       "      <td>AA</td>\n",
       "      <td>2395</td>\n",
       "      <td>MIA</td>\n",
       "      <td>LGA</td>\n",
       "      <td>25.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1096</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>171.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>9841 rows × 15 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           flight_date unique_carrier  flight_num origin dest  arr_delay  \\\n",
       "4      06/01/2015 0:00             AA           1    JFK  LAX       25.0   \n",
       "7      09/01/2015 0:00             AA           1    JFK  LAX        6.0   \n",
       "14     03/01/2015 0:00             AA           2    LAX  JFK       24.0   \n",
       "15     04/01/2015 0:00             AA           2    LAX  JFK      150.0   \n",
       "23     12/01/2015 0:00             AA           2    LAX  JFK        9.0   \n",
       "29     05/01/2015 0:00             AA           3    JFK  LAX        4.0   \n",
       "30     06/01/2015 0:00             AA           3    JFK  LAX       52.0   \n",
       "33     09/01/2015 0:00             AA           3    JFK  LAX       18.0   \n",
       "36     12/01/2015 0:00             AA           3    JFK  LAX       10.0   \n",
       "40     03/01/2015 0:00             AA           4    LAX  JFK       56.0   \n",
       "41     04/01/2015 0:00             AA           4    LAX  JFK       68.0   \n",
       "43     06/01/2015 0:00             AA           4    LAX  JFK       10.0   \n",
       "44     07/01/2015 0:00             AA           4    LAX  JFK       63.0   \n",
       "48     11/01/2015 0:00             AA           4    LAX  JFK      214.0   \n",
       "52     02/01/2015 0:00             AA           5    DFW  HNL      306.0   \n",
       "53     03/01/2015 0:00             AA           5    DFW  HNL       10.0   \n",
       "54     04/01/2015 0:00             AA           5    DFW  HNL      220.0   \n",
       "55     05/01/2015 0:00             AA           5    DFW  HNL       79.0   \n",
       "56     06/01/2015 0:00             AA           5    DFW  HNL        1.0   \n",
       "57     07/01/2015 0:00             AA           5    DFW  HNL       31.0   \n",
       "58     08/01/2015 0:00             AA           5    DFW  HNL      170.0   \n",
       "63     13/01/2015 0:00             AA           5    DFW  HNL       30.0   \n",
       "67     04/01/2015 0:00             AA           6    OGG  DFW       39.0   \n",
       "68     05/01/2015 0:00             AA           6    OGG  DFW        3.0   \n",
       "69     06/01/2015 0:00             AA           6    OGG  DFW       73.0   \n",
       "74     11/01/2015 0:00             AA           6    OGG  DFW       68.0   \n",
       "78     02/01/2015 0:00             AA           7    DFW  OGG      172.0   \n",
       "80     04/01/2015 0:00             AA           7    DFW  OGG      261.0   \n",
       "81     05/01/2015 0:00             AA           7    DFW  OGG      301.0   \n",
       "82     06/01/2015 0:00             AA           7    DFW  OGG       62.0   \n",
       "...                ...            ...         ...    ...  ...        ...   \n",
       "59282  04/01/2015 0:00             AA        2393    MCO  JFK       20.0   \n",
       "59283  05/01/2015 0:00             AA        2393    MCO  JFK        4.0   \n",
       "59284  06/01/2015 0:00             AA        2393    MCO  JFK        2.0   \n",
       "59285  07/01/2015 0:00             AA        2393    MCO  JFK       15.0   \n",
       "59286  08/01/2015 0:00             AA        2393    MCO  JFK       18.0   \n",
       "59287  09/01/2015 0:00             AA        2393    MCO  JFK       47.0   \n",
       "59288  10/01/2015 0:00             AA        2393    MCO  JFK        4.0   \n",
       "59290  12/01/2015 0:00             AA        2393    MCO  JFK       13.0   \n",
       "59292  14/01/2015 0:00             AA        2393    MCO  JFK       12.0   \n",
       "59293  02/01/2015 0:00             AA        2394    DFW  SNA       30.0   \n",
       "59297  07/01/2015 0:00             AA        2394    DFW  SNA       77.0   \n",
       "59299  09/01/2015 0:00             AA        2394    DFW  SNA       22.0   \n",
       "59300  11/01/2015 0:00             AA        2394    DFW  SNA       21.0   \n",
       "59304  02/01/2015 0:00             AA        2394    SNA  DFW       44.0   \n",
       "59307  06/01/2015 0:00             AA        2394    SNA  DFW        9.0   \n",
       "59308  07/01/2015 0:00             AA        2394    SNA  DFW       76.0   \n",
       "59310  09/01/2015 0:00             AA        2394    SNA  DFW       18.0   \n",
       "59311  11/01/2015 0:00             AA        2394    SNA  DFW        9.0   \n",
       "59315  02/01/2015 0:00             AA        2395    BHM  DFW        4.0   \n",
       "59317  04/01/2015 0:00             AA        2395    BHM  DFW       15.0   \n",
       "59319  06/01/2015 0:00             AA        2395    LGA  MIA       36.0   \n",
       "59320  07/01/2015 0:00             AA        2395    LGA  MIA       23.0   \n",
       "59321  08/01/2015 0:00             AA        2395    LGA  MIA      117.0   \n",
       "59322  09/01/2015 0:00             AA        2395    LGA  MIA       16.0   \n",
       "59327  14/01/2015 0:00             AA        2395    LGA  MIA        7.0   \n",
       "59329  07/01/2015 0:00             AA        2395    MIA  LGA       57.0   \n",
       "59330  08/01/2015 0:00             AA        2395    MIA  LGA        3.0   \n",
       "59331  09/01/2015 0:00             AA        2395    MIA  LGA       55.0   \n",
       "59332  10/01/2015 0:00             AA        2395    MIA  LGA       26.0   \n",
       "59334  12/01/2015 0:00             AA        2395    MIA  LGA       25.0   \n",
       "\n",
       "       cancelled  distance  carrier_delay  weather_delay  late_aircraft_delay  \\\n",
       "4              0      2475            0.0            0.0                  0.0   \n",
       "7              0      2475            NaN            NaN                  NaN   \n",
       "14             0      2475           22.0            0.0                  0.0   \n",
       "15             0      2475            0.0            0.0                105.0   \n",
       "23             0      2475            NaN            NaN                  NaN   \n",
       "29             0      2475            NaN            NaN                  NaN   \n",
       "30             0      2475            0.0            0.0                  0.0   \n",
       "33             0      2475            0.0            0.0                  0.0   \n",
       "36             0      2475            NaN            NaN                  NaN   \n",
       "40             0      2475            0.0            0.0                 39.0   \n",
       "41             0      2475            0.0            0.0                  3.0   \n",
       "43             0      2475            NaN            NaN                  NaN   \n",
       "44             0      2475            0.0            0.0                  8.0   \n",
       "48             0      2475           11.0            0.0                203.0   \n",
       "52             0      3784           21.0            0.0                256.0   \n",
       "53             0      3784            NaN            NaN                  NaN   \n",
       "54             0      3784          220.0            0.0                  0.0   \n",
       "55             0      3784           79.0            0.0                  0.0   \n",
       "56             0      3784            NaN            NaN                  NaN   \n",
       "57             0      3784           31.0            0.0                  0.0   \n",
       "58             0      3784          170.0            0.0                  0.0   \n",
       "63             0      3784           26.0            0.0                  0.0   \n",
       "67             0      3711           37.0            0.0                  0.0   \n",
       "68             0      3711            NaN            NaN                  NaN   \n",
       "69             0      3711            4.0            0.0                 60.0   \n",
       "74             0      3711            0.0            0.0                 68.0   \n",
       "78             0      3711          153.0            0.0                  0.0   \n",
       "80             0      3711          261.0            0.0                  0.0   \n",
       "81             0      3711          254.0            0.0                 47.0   \n",
       "82             0      3711           62.0            0.0                  0.0   \n",
       "...          ...       ...            ...            ...                  ...   \n",
       "59282          0       944            0.0            0.0                  0.0   \n",
       "59283          0       944            NaN            NaN                  NaN   \n",
       "59284          0       944            NaN            NaN                  NaN   \n",
       "59285          0       944            4.0            0.0                 11.0   \n",
       "59286          0       944            0.0            0.0                  6.0   \n",
       "59287          0       944            1.0            0.0                 46.0   \n",
       "59288          0       944            NaN            NaN                  NaN   \n",
       "59290          0       944            NaN            NaN                  NaN   \n",
       "59292          0       944            NaN            NaN                  NaN   \n",
       "59293          0      1205           14.0            0.0                 16.0   \n",
       "59297          0      1205           77.0            0.0                  0.0   \n",
       "59299          0      1205            4.0            0.0                 18.0   \n",
       "59300          0      1205           21.0            0.0                  0.0   \n",
       "59304          0      1205           10.0            0.0                 30.0   \n",
       "59307          0      1205            NaN            NaN                  NaN   \n",
       "59308          0      1205            0.0            0.0                 69.0   \n",
       "59310          0      1205            0.0            0.0                 14.0   \n",
       "59311          0      1205            NaN            NaN                  NaN   \n",
       "59315          0       597            NaN            NaN                  NaN   \n",
       "59317          0       597           15.0            0.0                  0.0   \n",
       "59319          0      1096            0.0            6.0                  0.0   \n",
       "59320          0      1096            0.0            0.0                 17.0   \n",
       "59321          0      1096          117.0            0.0                  0.0   \n",
       "59322          0      1096            4.0            0.0                 12.0   \n",
       "59327          0      1096            NaN            NaN                  NaN   \n",
       "59329          0      1096            0.0            0.0                  0.0   \n",
       "59330          0      1096            NaN            NaN                  NaN   \n",
       "59331          0      1096           12.0            0.0                 43.0   \n",
       "59332          0      1096           12.0            0.0                 14.0   \n",
       "59334          0      1096            0.0            0.0                  0.0   \n",
       "\n",
       "       nas_delay  security_delay  actual_elapsed_time  delayed  \n",
       "4           25.0             0.0                424.0     True  \n",
       "7            NaN             NaN                400.0     True  \n",
       "14           2.0             0.0                337.0     True  \n",
       "15          45.0             0.0                324.0     True  \n",
       "23           NaN             NaN                338.0     True  \n",
       "29           NaN             NaN                390.0     True  \n",
       "30          52.0             0.0                440.0     True  \n",
       "33          18.0             0.0                403.0     True  \n",
       "36           NaN             NaN                399.0     True  \n",
       "40          17.0             0.0                347.0     True  \n",
       "41          65.0             0.0                326.0     True  \n",
       "43           NaN             NaN                329.0     True  \n",
       "44          55.0             0.0                317.0     True  \n",
       "48           0.0             0.0                302.0     True  \n",
       "52          29.0             0.0                544.0     True  \n",
       "53           NaN             NaN                501.0     True  \n",
       "54           0.0             0.0                500.0     True  \n",
       "55           0.0             0.0                505.0     True  \n",
       "56           NaN             NaN                491.0     True  \n",
       "57           0.0             0.0                507.0     True  \n",
       "58           0.0             0.0                500.0     True  \n",
       "63           4.0             0.0                527.0     True  \n",
       "67           2.0             0.0                427.0     True  \n",
       "68           NaN             NaN                424.0     True  \n",
       "69           9.0             0.0                433.0     True  \n",
       "74           0.0             0.0                420.0     True  \n",
       "78          19.0             0.0                519.0     True  \n",
       "80           0.0             0.0                492.0     True  \n",
       "81           0.0             0.0                481.0     True  \n",
       "82           0.0             0.0                486.0     True  \n",
       "...          ...             ...                  ...      ...  \n",
       "59282       20.0             0.0                173.0     True  \n",
       "59283        NaN             NaN                144.0     True  \n",
       "59284        NaN             NaN                154.0     True  \n",
       "59285        0.0             0.0                133.0     True  \n",
       "59286       12.0             0.0                156.0     True  \n",
       "59287        0.0             0.0                130.0     True  \n",
       "59288        NaN             NaN                149.0     True  \n",
       "59290        NaN             NaN                159.0     True  \n",
       "59292        NaN             NaN                161.0     True  \n",
       "59293        0.0             0.0                185.0     True  \n",
       "59297        0.0             0.0                171.0     True  \n",
       "59299        0.0             0.0                172.0     True  \n",
       "59300        0.0             0.0                198.0     True  \n",
       "59304        4.0             0.0                169.0     True  \n",
       "59307        NaN             NaN                187.0     True  \n",
       "59308        7.0             0.0                171.0     True  \n",
       "59310        4.0             0.0                168.0     True  \n",
       "59311        NaN             NaN                155.0     True  \n",
       "59315        NaN             NaN                151.0     True  \n",
       "59317        0.0             0.0                127.0     True  \n",
       "59319       30.0             0.0                238.0     True  \n",
       "59320        6.0             0.0                214.0     True  \n",
       "59321        0.0             0.0                196.0     True  \n",
       "59322        0.0             0.0                199.0     True  \n",
       "59327        NaN             NaN                218.0     True  \n",
       "59329       57.0             0.0                168.0     True  \n",
       "59330        NaN             NaN                182.0     True  \n",
       "59331        0.0             0.0                157.0     True  \n",
       "59332        0.0             0.0                170.0     True  \n",
       "59334       25.0             0.0                171.0     True  \n",
       "\n",
       "[9841 rows x 15 columns]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "group_by_carrier.get_group(('AA', True))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "unique_carrier  delayed\n",
       "AA              False       8912\n",
       "                True        9841\n",
       "AS              False       3527\n",
       "                True        2104\n",
       "B6              False       4832\n",
       "                True        4401\n",
       "DL              False      17719\n",
       "                True        9803\n",
       "EV              False      10596\n",
       "                True       11371\n",
       "F9              False       1103\n",
       "                True        1848\n",
       "HA              False       1351\n",
       "                True        1354\n",
       "MQ              False       4692\n",
       "                True        8060\n",
       "NK              False       1550\n",
       "                True        2133\n",
       "OO              False       9977\n",
       "                True       10804\n",
       "UA              False       7885\n",
       "                True        8624\n",
       "US              False       7850\n",
       "                True        6353\n",
       "VX              False       1254\n",
       "                True         781\n",
       "WN              False      21789\n",
       "                True       21150\n",
       "dtype: int64"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "group_by_carrier.size()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "count_delays_by_carrier = group_by_carrier.size().unstack()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x115edaa58>"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA7UAAAFpCAYAAABDOg9IAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xu4Z3VdN/z3hwEdEAlF8CbRBn08AHKIGTyhpaip5SnU\nBCm0K5/xTk20eCzL+xmozCzMPPBUcHsKTUQN1BTLUDtAHva2QZCDKGCOkiCgQoHC8Hn+2L/h3gzD\nzN7D3r/fXjOv13Xta//Wd/3WWu99XawL3qy1vqu6OwAAADBEO0w6AAAAAGwtpRYAAIDBUmoBAAAY\nLKUWAACAwVJqAQAAGCylFgAAgMFSagEAABgspRYAAIDBUmoBAAAYLKUWAACAwdpx0gG21v3ud79e\nsWLFpGMAAACwCKanp7/X3Xtu6XuDLbUrVqzI1NTUpGMAAACwCKrqm3P5ntuPAQAAGCylFgAAgMFS\nagEAABiswT5TOz2dVE06BQDMU5846QQAbOc6ayYdYUG5UgsAAMBgLVqpraq3VNWrZy3/fVX971nL\nb66q36yqrqrfmDX+jqp6yWLlAgAAYNuxmFdqz03yuCSpqh2S3C/JAbPWPy7JeUmuTnJcVd1jEbMA\nAACwDVrMUntekseOPh+Q5MIkN1TVfarqnkn2S3JdkmuSnJPkxYuYBQAAgG3Qok0U1d3fqapbq+pB\nmbkq+29JHpCZovuDJBck+fHo629KcnZVvWux8gAAALDtWezZj8/LTKF9XJI/y0ypfVxmSu25G77U\n3ZdX1ReSvGhzO6uq1UlWzyw9aFECAwAAMByLPfvxhudqD8zM7cefz8yV2g3P0872R0l+O8ldvqin\nu0/p7lXdvSrZc3ESAwAAMBiLXWrPS/LMJNd19/ruvi7J7pkptncotd19SZKLkjxrkTMBAACwjVjs\nUntBZmY9/vxGYz/o7u9t4vtvSLLPImcCAABgG7Goz9R29/oku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e9/f4499tgFyzvO248BAABY\n4jZ1+/Ett9ySV77ylVm7dm2WLVuWr33ta3fa7rGPfWze8IY3ZN26dTnyyCPz0Ic+NOecc06mp6dz\n2GGHJZkpzHvttdeC5h1sqV25MtnofwyQJFkz6QAAAMA25i1veUvuf//75/zzz89tt92W5cuX3+k7\nL3rRi/LoRz86n/jEJ/LzP//z+au/+qt0d1784hfnjW9846JlG/crfQAAABiYH/zgB9l7772zww47\n5LTTTtvkc7GXX355HvzgB+dVr3pVnvOc5+QrX/lKnvzkJ+fDH/5wrr766iTJddddl29+85sLmk2p\nBQAAYLNe/vKX573vfW8OPvjgXHLJJbnXve51p++cccYZeeQjH5lDDjkkF154YY499tjsv//++cM/\n/MP83M/9XA466KA89alPzVVXXbWg2arnMqfzErRq1are+MFkAACAIbv44ouz3377TTrG2G3q766q\n6e5etaXujmXuAAAHr0lEQVRtXakFAABgsJRaAAAABkupBQAAYLCUWgAAAAZLqQUAAGCwlFoAAAAG\na8dJBwAAAGBpuPbaa/PkJz85SfKf//mfWbZsWfbcc88kyRe/+MXc4x73mGS8TRpsqZ2eTqomnQLu\nhj5x0glgSeismXQEAFiyKgv734xb+vfuHnvskbVr1yZJTjjhhOy66645/vjj77iP7nR3dthhadz4\nuzRSAAAAsGR9/etfz/77759jjjkmBxxwQL71rW9l9913v3396aefnpe+9KVJku9+97s58sgjs2rV\nqjzqUY/K5z//+UXNNvZSW1XPraquqkdsNP7qqrq5qn5i3JkAAADYvEsuuSSvec1rctFFF+UBD3jA\nXX7vVa96VV772tdmamoqZ5xxxu1ld7FM4vbjo5P86+j3mo3Gv5TkyCTvnkAuAAAA7sJDHvKQrFq1\naovf+8d//Mdceumlty9ff/31uemmm7LzzjsvSq6xltqq2jXJ45M8KcnHMyq1VfWQJLsmeXmS34tS\nCwAAsKTc6173uv3zDjvskO6+ffnmm2++/XN3j3VSqXHffvycJJ/q7q8lubaqVo7Gj0pyepJ/SfLw\nqrr/mHMBAAAwRzvssEPuc5/75LLLLstt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m+3t2Xd/ePk5ye5DkTzgQLqrv/Ocl1Gw0/J8l7\nR5/fm+S5s8ZP7+4fdfcVSb6e5FFVtXeS3br78z3z8Pxfb7TNhn19OMmTN/zfR1iKuvuq7v7y6PMN\nmfkPlQfEecF2rGfcOFrcafTTcV6wnauqfZL8QpL/PWvYebENG2KpfUCSb81aXjcag23d/bv7qtHn\n/0xy/9HnuzonHjD6vPH4Hbbp7luT/CDJHosTGxbW6Davn07yhTgv2M6NbrFcm+TqJJ/ubucFJH+e\n5LVJbps15rzYhg2x1MJ2b/R/DE1dznanqnZN8pEkr+7uH85e57xge9Td67v7kCT7ZObq0iM3Wu+8\nYLtSVc9McnV3T9/Vd5wX254hltpvJ3ngrOV9RmOwrfvu6FaYjH5fPRq/q3Pi26PPG4/fYZuq2jHJ\nTyS5dtGSwwKoqp0yU2jf391/Oxp2XkCS7v5+ks9m5pk/5wXbs8OTPLuqrszMY4pHVNX74rzYpg2x\n1H4pyUOrat+qukdmHuz+2IQzwTh8LMmLR59fnOSjs8aPGs3Et29mJjL44ugWmx9W1WNGz3kcu9E2\nG/b1/CSfaS+tZgkb/TP8ziQXd/efzVrlvGC7VVV7VtXuo887J3lqkkvivGA71t2v6+59untFZnrC\nZ7r7l+O82KbtOOkA89Xdt1bVK5P8fZJlSd7V3V+dcCxYUFX1gSRPTHK/qlqXZE2SP05yRlX9WpJv\nJvmlJOnur1bVGUkuyswMsa/o7vWjXb08MzMp75zk7NFPMlMOTquqr2dmQqqjxvBnwd1xeJJfSXLB\n6PnBJPndOC/Yvu2d5L2jmVp3SHJGd/9dVf1bnBewMf++2IaV/6kAAADAUA3x9mMAAABIotQCAAAw\nYEotAAAAg6XUAgAAMFhKLQAAAIOl1AIAADBYSi0AAACDpdQCAAAwWP8/P1cOMswu15wAAAAASUVO\nRK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x115efe6d8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "count_delays_by_carrier.plot(kind='barh', stacked=True, figsize=[16,6], colormap='winter')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(201664, 15)"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "apply_demo.csv     demo_duplicate.csv \u001b[31mmovie_metadata.csv\u001b[m\u001b[m usa_flights.csv\r\n",
      "city_weather.csv   iris.csv           sales-funnel.xlsx\r\n"
     ]
    }
   ],
   "source": [
    "!ls ../homework/"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Account</th>\n",
       "      <th>Name</th>\n",
       "      <th>Rep</th>\n",
       "      <th>Manager</th>\n",
       "      <th>Product</th>\n",
       "      <th>Quantity</th>\n",
       "      <th>Price</th>\n",
       "      <th>Status</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>714466</td>\n",
       "      <td>Trantow-Barrows</td>\n",
       "      <td>Craig Booker</td>\n",
       "      <td>Debra Henley</td>\n",
       "      <td>CPU</td>\n",
       "      <td>1</td>\n",
       "      <td>30000</td>\n",
       "      <td>presented</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>714466</td>\n",
       "      <td>Trantow-Barrows</td>\n",
       "      <td>Craig Booker</td>\n",
       "      <td>Debra Henley</td>\n",
       "      <td>Software</td>\n",
       "      <td>1</td>\n",
       "      <td>10000</td>\n",
       "      <td>presented</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>714466</td>\n",
       "      <td>Trantow-Barrows</td>\n",
       "      <td>Craig Booker</td>\n",
       "      <td>Debra Henley</td>\n",
       "      <td>Maintenance</td>\n",
       "      <td>2</td>\n",
       "      <td>5000</td>\n",
       "      <td>pending</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>737550</td>\n",
       "      <td>Fritsch, Russel and Anderson</td>\n",
       "      <td>Craig Booker</td>\n",
       "      <td>Debra Henley</td>\n",
       "      <td>CPU</td>\n",
       "      <td>1</td>\n",
       "      <td>35000</td>\n",
       "      <td>declined</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>146832</td>\n",
       "      <td>Kiehn-Spinka</td>\n",
       "      <td>Daniel Hilton</td>\n",
       "      <td>Debra Henley</td>\n",
       "      <td>CPU</td>\n",
       "      <td>2</td>\n",
       "      <td>65000</td>\n",
       "      <td>won</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Account                          Name            Rep       Manager  \\\n",
       "0   714466               Trantow-Barrows   Craig Booker  Debra Henley   \n",
       "1   714466               Trantow-Barrows   Craig Booker  Debra Henley   \n",
       "2   714466               Trantow-Barrows   Craig Booker  Debra Henley   \n",
       "3   737550  Fritsch, Russel and Anderson   Craig Booker  Debra Henley   \n",
       "4   146832                  Kiehn-Spinka  Daniel Hilton  Debra Henley   \n",
       "\n",
       "       Product  Quantity  Price     Status  \n",
       "0          CPU         1  30000  presented  \n",
       "1     Software         1  10000  presented  \n",
       "2  Maintenance         2   5000    pending  \n",
       "3          CPU         1  35000   declined  \n",
       "4          CPU         2  65000        won  "
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_excel('../homework/sales-funnel.xlsx')\n",
    "pd.pivot_table(df,index=[\"Name\"])\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Account</th>\n",
       "      <th>Price</th>\n",
       "      <th>Quantity</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Name</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Barton LLC</th>\n",
       "      <td>740150.0</td>\n",
       "      <td>35000.0</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Fritsch, Russel and Anderson</th>\n",
       "      <td>737550.0</td>\n",
       "      <td>35000.0</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Herman LLC</th>\n",
       "      <td>141962.0</td>\n",
       "      <td>65000.0</td>\n",
       "      <td>2.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Jerde-Hilpert</th>\n",
       "      <td>412290.0</td>\n",
       "      <td>5000.0</td>\n",
       "      <td>2.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Kassulke, Ondricka and Metz</th>\n",
       "      <td>307599.0</td>\n",
       "      <td>7000.0</td>\n",
       "      <td>3.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Keeling LLC</th>\n",
       "      <td>688981.0</td>\n",
       "      <td>100000.0</td>\n",
       "      <td>5.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Kiehn-Spinka</th>\n",
       "      <td>146832.0</td>\n",
       "      <td>65000.0</td>\n",
       "      <td>2.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Koepp Ltd</th>\n",
       "      <td>729833.0</td>\n",
       "      <td>35000.0</td>\n",
       "      <td>2.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Kulas Inc</th>\n",
       "      <td>218895.0</td>\n",
       "      <td>25000.0</td>\n",
       "      <td>1.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Purdy-Kunde</th>\n",
       "      <td>163416.0</td>\n",
       "      <td>30000.0</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Stokes LLC</th>\n",
       "      <td>239344.0</td>\n",
       "      <td>7500.0</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Trantow-Barrows</th>\n",
       "      <td>714466.0</td>\n",
       "      <td>15000.0</td>\n",
       "      <td>1.333333</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                               Account     Price  Quantity\n",
       "Name                                                      \n",
       "Barton LLC                    740150.0   35000.0  1.000000\n",
       "Fritsch, Russel and Anderson  737550.0   35000.0  1.000000\n",
       "Herman LLC                    141962.0   65000.0  2.000000\n",
       "Jerde-Hilpert                 412290.0    5000.0  2.000000\n",
       "Kassulke, Ondricka and Metz   307599.0    7000.0  3.000000\n",
       "Keeling LLC                   688981.0  100000.0  5.000000\n",
       "Kiehn-Spinka                  146832.0   65000.0  2.000000\n",
       "Koepp Ltd                     729833.0   35000.0  2.000000\n",
       "Kulas Inc                     218895.0   25000.0  1.500000\n",
       "Purdy-Kunde                   163416.0   30000.0  1.000000\n",
       "Stokes LLC                    239344.0    7500.0  1.000000\n",
       "Trantow-Barrows               714466.0   15000.0  1.333333"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_pivot = pd.pivot_table(df,index=[\"Name\"])\n",
    "df_pivot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>sum</th>\n",
       "      <th>mean</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>Price</th>\n",
       "      <th>Price</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Manager</th>\n",
       "      <th>Rep</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">Debra Henley</th>\n",
       "      <th>Craig Booker</th>\n",
       "      <td>80000</td>\n",
       "      <td>20000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Daniel Hilton</th>\n",
       "      <td>115000</td>\n",
       "      <td>38333.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>John Smith</th>\n",
       "      <td>40000</td>\n",
       "      <td>20000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Fred Anderson</th>\n",
       "      <th>Cedric Moss</th>\n",
       "      <td>110000</td>\n",
       "      <td>27500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Wendy Yule</th>\n",
       "      <td>177000</td>\n",
       "      <td>44250.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                sum          mean\n",
       "                              Price         Price\n",
       "Manager       Rep                                \n",
       "Debra Henley  Craig Booker    80000  20000.000000\n",
       "              Daniel Hilton  115000  38333.333333\n",
       "              John Smith      40000  20000.000000\n",
       "Fred Anderson Cedric Moss    110000  27500.000000\n",
       "              Wendy Yule     177000  44250.000000"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(df, index=['Manager','Rep'], values=['Price'],aggfunc=[sum,np.mean])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
